//
//  PresentationController.swift
//  NavPushAni
//
//  Created by 李煜 on 2022/8/19.
//

import UIKit

class OMPresentationController: UIPresentationController {
//  蒙版
  lazy var mask = UIView()

  override func containerViewWillLayoutSubviews() {
    super.containerViewWillLayoutSubviews()

    presentedView?.frame = CGRect(x: 100, y: 90, width: 200, height: 200)
  }
  override func containerViewDidLayoutSubviews() {
    super.containerViewDidLayoutSubviews()


    mask.frame = containerView!.bounds
    mask.backgroundColor = .init(white: 0.2, alpha: 0.9)
    containerView?.insertSubview(mask, at: 0)

//    添加手势
    let ges = UITapGestureRecognizer(target: self, action: #selector(clickMask))
    mask.addGestureRecognizer(ges)
  }
  @objc func clickMask() {
print("ges")
    presentedViewController.dismiss(animated: true)
  }
}
